package io.renren.modules.book.mq;

import org.junit.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 模拟一秒500次访问，写入mq
 */
@Component
public class ReadMqSend {
    @Autowired
    RabbitTemplate rabbitTemplate;
  //  @Scheduled(cron = "0/5 * * * * ? ")
    public void Send(){
        for (int i=0;i<100;i++){
            String message = "这是第"+i+"条消息！！！";
            rabbitTemplate.convertAndSend(RabbitConfig.EXCHANGE_DIRECT_HUANG, RabbitConfig.ROUTINGKEY_DIRECT_HUANG, message);
        }
    }
}
